import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:hongbao/page/home.dart';
import './route.dart';

void main() {
  final Router router = Router();
  RouteRule.configureRouteRule(router);

  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: new Scaffold(
        body: Center(
          child: HomePage(),
        ),
        bottomNavigationBar: _BottomNavigationWidget(),
      ),
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
    );
  }
}

// -----



class _BottomNavigationWidget extends StatefulWidget {
  @override
  _BottomNavigationWidgetState createState() => _BottomNavigationWidgetState();
}

class _BottomNavigationWidgetState extends State<_BottomNavigationWidget> {
  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    final _bottomNavigationColor = Theme.of(context).primaryColor;
    final _bottomNavigationBarItems = [
      BottomNavigationBarItem(
        icon: Icon(
          Icons.home,
          color: _bottomNavigationColor,
        ),
        title: Text(
          '首页',
          style: TextStyle(color: _bottomNavigationColor),
        ),
      ),
      BottomNavigationBarItem(
        icon: Icon(
          Icons.account_circle,
          color: _bottomNavigationColor,
        ),
        title: Text(
          '个人中心',
          style: TextStyle(color: _bottomNavigationColor),
        ),
      ),
    ];

    return new BottomNavigationBar(
      items: _bottomNavigationBarItems,
      currentIndex: _currentIndex,
      onTap: (int index) {
        setState(() {
          _currentIndex = index;
        });
      },
    );
  }
}